<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        body {
            display: flex;
            justify-content: center;
            margin: 0;
            transition: all 500ms;
            padding-top: 200px;
        }
        .btn {
            width: 60px;
            height: 60px;
            border-radius: 6px;
            box-shadow: 0 0 4px 2px #ccc,0 0 4px 2px #ccc inset;
            border: 1px solid #fff;
            display: flex;
            justify-content: center;
            align-items: center;
            cursor: pointer;
            color: #fff;
            text-shadow: 0 0 4px #ccc;
            background-color: rgba(155,155,155,.8);
            user-select: none;
            margin-right: 20px;
        }
        .btn:active {
            background-color: rgba(88,88,88,.8);
        }
    </style>
</head>
<body>
    <div id="off" class="btn-off btn">关灯</div>
    <div id="on" class="btn-on btn">开灯</div>
    <script>
        var btnOn = document.getElementById('on')
        var btnOff = document.getElementById('off')
        btnOn.onclick = function(){
            document.body.style.backgroundColor = ''
        }
        btnOff.onclick = function(){
            document.body.style.backgroundColor = '#333'
        }
    </script>
</body>
</html>